load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "distsql",
    srcs = [
        "distsql.go",
        "request_builder.go",
        "select_result.go",
    ],
    importpath = "github.com/pingcap/tidb/distsql",
    visibility = ["//visibility:public"],
    deps = [
        "//config",
        "//ddl/placement",
        "//errno",
        "//expression",
        "//infoschema",
        "//kv",
        "//metrics",
        "//parser/mysql",
        "//parser/terror",
        "//planner/util",
        "//sessionctx",
        "//sessionctx/stmtctx",
        "//sessionctx/variable",
        "//store/copr",
        "//tablecodec",
        "//telemetry",
        "//types",
        "//util/chunk",
        "//util/codec",
        "//util/collate",
        "//util/dbterror",
        "//util/execdetails",
        "//util/logutil",
        "//util/memory",
        "//util/ranger",
        "//util/tracing",
        "//util/trxevents",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_pingcap_tipb//go-tipb",
        "@com_github_tikv_client_go_v2//metrics",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//tikvrpc",
        "@com_github_tikv_client_go_v2//tikvrpc/interceptor",
        "@org_golang_google_grpc//metadata",
        "@org_golang_x_exp//maps",
        "@org_uber_go_zap//:zap",
    ],
)

go_test(
    name = "distsql_test",
    timeout = "short",
    srcs = [
        "bench_test.go",
        "distsql_test.go",
        "main_test.go",
        "request_builder_test.go",
        "select_result_test.go",
    ],
    embed = [":distsql"],
    flaky = True,
    race = "on",
    shard_count = 24,
    deps = [
        "//domain/resourcegroup",
        "//kv",
        "//parser/charset",
        "//parser/mysql",
        "//sessionctx",
        "//sessionctx/stmtctx",
        "//sessionctx/variable",
        "//store/copr",
        "//tablecodec",
        "//testkit/testsetup",
        "//types",
        "//util/benchdaily",
        "//util/chunk",
        "//util/codec",
        "//util/collate",
        "//util/disk",
        "//util/execdetails",
        "//util/mathutil",
        "//util/memory",
        "//util/mock",
        "//util/paging",
        "//util/ranger",
        "@com_github_pingcap_tipb//go-tipb",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//kv",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//tikvrpc",
        "@org_uber_go_goleak//:goleak",
    ],
)
